import { BASE_URL, TIME_OUT } from './config'
import HYRequest from './request'
import { localCache } from '@/utils/cache'
const hyRequest = new HYRequest({
  baseURL: BASE_URL,
  timeout: TIME_OUT,
  interceptors:{
    requestSuccessFn: (config) => {
      // console.log('请求成功拦截')
      const token = localCache.getCache('token')
      if(config.headers && token){
        config.headers.Authorization = ' Bearer' + token
      }
      return config
    }
  }
})

export default hyRequest
